package view.main;

import info.clearthought.layout.TableLayout;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;

public class Information extends JFrame {

  private static final long serialVersionUID = 3L;

  JLabel label_;

  public Information() {

    this.setTitle("Information");

    Container cp = this.getContentPane();

    // sets the layout using table layout
    double[][] table_size = {
        {300.0},
        {250.0}
    };

    // table layout if x, y

    cp.setLayout(new TableLayout(table_size));

    label_ = new JLabel();
    label_.setVerticalAlignment(JLabel.TOP);

    cp.add(new JScrollPane(label_), "0, 0");

    this.pack();

    this.setDefaultCloseOperation(HIDE_ON_CLOSE);
    this.setVisible(false);
  }

  public void displayInformation(String text) {
    label_.setText("<html><table><td width='230'>" + 
            text +
            "</td></table></html>");
    this.setVisible(true);
  }

}
